﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GDISim._Infrastructure._Software._Operation
{
    public class OperationRequest
    {
        #region members
        private TimeSpan operationTime;
        private Guid operationId;
        private OperationType operationType;
        #endregion

        #region constructor
        public OperationRequest() { }
        public OperationRequest(TimeSpan operationTime, Guid operationId, OperationType operationType)
        {
            this.operationTime = operationTime;
            this.operationId = operationId;
            this.operationType = operationType;
        }
        #endregion

        #region properties
        public TimeSpan OperationTime
        {
            get
            {
                return this.operationTime;
            }
            set
            {
                this.operationTime = value;
            }
        }

        public Guid OperationId
        {
            get
            {
                return this.operationId;
            }
            set
            {
                this.operationId = value;
            }
        }

        public OperationType OperationType
        {
            get
            {
                return this.operationType;
            }
            set
            {
                this.operationType = value;
            }
        }
        #endregion

        #region methods
        public static int CompareOperationRequestTimes(OperationRequest x, OperationRequest y)
        {
            if (x == null)
            {
                if (y == null)
                {

                    return 0;
                }
                else
                {

                    return -1;
                }
            }
            else
            {

                if (y == null)
                {
                    return 1;
                }
                else
                {
                    int retval = x.OperationTime.CompareTo(y.OperationTime);

                    if (retval != 0)
                    {
                        return retval;
                    }
                    else
                    {
                        return 1;
                    }
                }
            }
        }
        #endregion
    }
}
